package com.rech.broadcastReceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;

import com.rech.xbexpress3.FullscreenActivity;

import static dou.utils.HandleUtil.runOnUiThread;

/**
 * 自定义 广播接收者
 * 继承 android.content.BroadcastReceiver
 */
public class MyBroadcastReceiver extends BroadcastReceiver {
    private final String ACTION_BOOT = "android.intent.action.BOOT_COMPLETED";
    /**
     * 接收广播消息后都会进入 onReceive 方法，然后要做的就是对相应的消息做出相应的处理
     *
     * @param context 表示广播接收器所运行的上下文
     * @param intent  表示广播接收器收到的Intent
     */
    @Override
    public void onReceive(final Context context, Intent intent) {
        Intent intent1 = new Intent(context,FullscreenActivity.class);
        intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent1 );
        /*Log.i("Wmx logs::", intent.getAction());

        *//**
         * 如果 系统 启动的消息，则启动 APP 主页活动
         *//*
        if (ACTION_BOOT.equals(intent.getAction())) {

            Intent intentMainActivity = new Intent(context, FullscreenActivity.class);
            intentMainActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intentMainActivity);
            Toast.makeText(context, "开机完毕~", Toast.LENGTH_LONG).show();

             //引擎初始化延迟2s进行
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Handler handler = new Handler();
                    handler.postDelayed(new Runnable() {
                        @Override
                        public void run() {

                        }
                    }, 16000);
                }
            });*/

    }
}
